<!--
  @author heguanghua
  @since 2019/06/12 19:34
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<table class="layui-hide" id="zmn-table" lay-filter="zmn-table" th:fragment="table">
    <thead>
    <tr>
        <th lay-data="{field:'sort', width:90, unresize:true, fixed:'left', sort:true, align:'center', edit:'text'}">排序</th>
        <th lay-data="{field:'contractId', width:80, fixed:'left', unresize:true, align:'center'}">ID</th>
        <th lay-data="{field:'name', width:200, unresize:true, fixed:'left', align:'center'}">合同名称</th>
        <th lay-data="{field:'contractNo', unresize:true, align:'center',width:140}">合同编号</th>
        <th lay-data="{field:'subjectAmountYuan', unresize:true, align:'center',width:110}">标的金额</th>
        <th lay-data="{field:'subject', unresize:true, align:'center',width:100}">合同主体</th>
        <th lay-data="{field:'contractBeginDay', unresize:true, align:'center',width:100}">合同始期</th>
        <th lay-data="{field:'contractEndDay', unresize:true, align:'center',width:100}">合同终期</th>
        <th lay-data="{field:'contractType', unresize:true, align:'center',width:100}">合同类型</th>
        <th lay-data="{field:'signDay', unresize:true, align:'center',width:100}">签订日期</th>
        <th lay-data="{field:'agent', unresize:true, align:'center',width:150}">经办人</th>
        <th lay-data="{field:'agentCompanyId', unresize:true, align:'center',width:100}">所属公司</th>
        <th lay-data="{field:'agentDept', unresize:true, align:'center',width:200}">所属管理部门</th>
        <th lay-data="{field:'secret', width:80, unresize:true, align:'center'}">是否机密</th>
        <th lay-data="{field:'performance', width:100, unresize:true, align:'center'}">合同履行情况</th>
        <th lay-data="{field:'paymentStatus', width:100, unresize:true, align:'center'}">付款状态</th>
        <th lay-data="{field:'status', width:100, unresize:true, align:'center'}">合同状态</th>
        <th lay-data="{field:'createTime', width:220, unresize:true, align:'center'}">创建人/创建时间</th>
        <th lay-data="{field:'files', width:260, unresize:true, align:'center'}">合同附件</th>
        <th lay-data="{field:'操作', width:120, unresize:true, align:'center', fixed:'right'}">操作</th>
    </tr>
    </thead>

    <tbody>
    <tr th:each="item:${items}">
        <td th:text="${item.sort}">sort</td>
        <td th:text="${item.contractId}">contractId</td>
        <td th:text="${item.name}">name</td>
        <td th:text="${item.contractNo}">contractNo</td>
        <td>
            <div style="text-align: right">
                [[${#numbers.formatDecimal(item.subjectAmount == 0 ? '':item.subjectAmountYuan,1,'COMMA',2,'POINT')}]]
            </div>
        </td>
        <td th:text="${item.subject}">subject</td>
        <td th:text="${T(com.zmn.common.utils.date.DateUtil).toString(item.contractBeginDay, 'yyyy-MM-dd')}">contractBeginDay</td>
        <td th:text="${T(com.zmn.common.utils.date.DateUtil).toString(item.contractEndDay, 'yyyy-MM-dd')}">contractEndDay</td>
        <td th:text="${T(com.zmn.plat.common.dictionary.ContractTypeEnum).of(item.contractType).name}">contractType</td>
        <td th:text="${T(com.zmn.common.utils.date.DateUtil).toString(item.signDay, 'yyyy-MM-dd')}">signDay</td>
        <td th:text="${item.agentStr}">agentStr</td>
        <td th:text="${item.agentCompanyName}">agentCompanyName</td>
        <td th:text="${item.agentDeptTwoName == '' ? item.agentDeptOneName : item.agentDeptOneName + '-' + item.agentDeptTwoName}" class="">dept</td>
        <td th:text="${item.secret == 2 ? '机密':'非机密'}">secret</td>
        <td th:text="${item.performance == null ? '': item.performance == 2 ? '已完成':'进行中'}">performance</td>
<!--        <td th:text="${item.paymentStatus}">paymentStatus</td>-->
        <td th:text="${T(com.zmn.plat.common.dictionary.ContractPaymentStatusEnum).of(item.paymentStatus).name}">paymentStatus</td>
        <td th:text="${item.status == null ? '': T(com.zmn.plat.common.dictionary.ContractStatusEnum).of(item.status).name}">status</td>

        <td th:text="${item.creater+'/'+T(com.zmn.common.utils.date.DateUtil).toString(item.createTime)}">updateTime</td>
        <td>
            <th:block th:each="attrEnum,iterStat: ${contractFileRecordMap[item.contractId]}">
                <span th:text="${T(com.zmn.plat.business.impl.upload.UrlUtils).getUrlFileName(attrEnum.fileSrc)}" style="font-family:'ArialMT', 'Arial';">attrEnum</span>
                <a th:if="${#authPermit.checkPermit('/contract/borrow/record/detail.action')}" style="color: #00a0e9" href="javascript:void(0)" th:onclick="addContractBorrowRecord([[${item.contractId}]],[[${T(com.zmn.plat.business.impl.upload.UrlUtils).getUrlFileName(attrEnum.fileSrc)}]],[[${attrEnum.fileSrc}]]);">下载</a>&nbsp;&nbsp;
            </th:block>
        </td>
        <td>
            <a th:if="${#authPermit.checkPermit('/contract/record/detail.action')}" style="color: #00a0e9" lay-text="详情" th:lay-href="|/contract/record/detail.action?contractId=${item.contractId}|">详情</a>&nbsp;&nbsp;&nbsp;&nbsp;
            <a th:if="${#authPermit.checkPermit('/contract/payment/record/list.action')}" style="color: #00a0e9" lay-text="收付记录" th:lay-href="|/contract/payment/record/list.action?contractId=${item.contractId}|">收付记录</a>
        </td>
    </tr>
    </tbody>
</table>
